package com.ssy.filter;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * ApplicationListener
 *
 * @author ssy
 * @date 2020/11/11
 **/
@WebListener
public class ApplicationListener implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        ServletContext context = sce.getServletContext();
        //将url前缀放入context的作用域
        context.setAttribute("ssy", "http://localhost:8080");
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
    }
}
